/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2device.gameserver.model.events.tvt;

import java.util.List;

import com.l2device.gameserver.model.actor.instance.L2PcInstance;
import com.l2device.gameserver.skills.AbnormalEffect;

/**
 * @author Anarchy
 *
 */
public class EventTeam
{
       private final List<L2PcInstance> _players;
       private final String _name;
       private int _points;
       private final int[] _respawnLoc;
      
       public EventTeam(List<L2PcInstance> players, String name, int points, int[] respawnLoc)
       {
               _players = players;
               _name = name;
               _points = points;
               _respawnLoc = respawnLoc;
              
               for (L2PcInstance p : _players)
               {
                       p.setEventTeam(this);
               }
       }
      
       public void teleportTeam(int x, int y, int z, boolean sendMessage)
       {
               for (L2PcInstance p : _players)
               {
                       p.teleToLocation(x, y, z, 1);
                       if (sendMessage)
                               p.sendMessage("TvT: Вы телепортированы в колизей.");
               }
       }
      
       public void paralize(boolean val)
       {
               if (val)
               {
                       for (L2PcInstance p : _players)
                       {
                               p.startAbnormalEffect(AbnormalEffect.ROOT);
                               p.setIsParalyzed(true);
                       }
               }
               else
               {
                       for (L2PcInstance p : _players)
                       {
                               p.stopAbnormalEffect(AbnormalEffect.ROOT);
                               p.setIsParalyzed(false);
                       }
               }
       }
      
       public void rewardTeam(int itemId, int count)
       {
               for (L2PcInstance p : _players)
               {
                       p.addItem("Event Reward", itemId, count, null, true);
               }
       }
      
       public void addPoints(int val)
       {
               _points += val;
       }
      
       public void removePoints(int val)
       {
               _points -= val;
       }
      
       public int getPoints()
       {
               return _points;
       }
      
       public int getRespawnX()
       {
               return _respawnLoc[0];
       }
      
       public int getRespawnY()
       {
               return _respawnLoc[1];
       }
      
       public int getRespawnZ()
       {
               return _respawnLoc[2];
       }
      
       public String getName()
       {
               return _name;
       }
      
       public List<L2PcInstance> getPlayers()
       {
               return _players;
       }
      
       public boolean containsPlayer(L2PcInstance p)
       {
               return _players.contains(p);
       }
}